import {type} from './../action'

const initialState = {
    menuName: '首页',
    token: '',
    title: '',
    info: {}
}

export default (state = initialState, action) => {
    switch (action.type) {
        case type.SWITCH_MENU:
            return {
                ...state,
                menuName: action.menuName
            }
        
        case type.GET_TOKEN:
            return {
                ...state,
                token: action.token
            }

        case type.SWITCH_TITLE:
            return {
                ...state,
                title: action.title
        }

        case type.ALERTINFO:
            return {
                ...state,
                info: action.info
        }

        default: 
            return {...state}
    }
}